<?php
session_start();
$order_user = $_SESSION['userid'];
date_default_timezone_set('prc');

$tableOrder = "orderlist";



$summary_year = $_REQUEST['year'];
$summary_month = $_REQUEST['month'];

if((!$summary_year)&&(!$summary_month))
{
$summary_year=date("Y");
$summary_month=date("m");
}



$search_key = $summary_year.$summary_month;

 

$sqlstr = "select count(nid) from $tableOrder where (search_key='$search_key' and user_id='$order_user')";

$query = mysql_query($sqlstr);


$sum = mysql_result($query, 0);

$result = mysql_query("select * from  $tableOrder where (search_key='$search_key' and user_id='$order_user') order by order_date,
product_name,nid
desc");

while ($row = mysql_fetch_array($result)) {
    $search_name[]       = $row['product_name'];
    $search_date[]       = $row['order_date'];
    $search_num[]        = $row['product_num'];
    $search_price[]      = $row['order_price'];
    $search_order_id[]   = $row['order_id'];
    $search_product_id[] = $row['product_id'];
    $search_nid[]        = $row['nid'];
}


?>